@page "~/manager/config"
@model ConfigEditViewModel
@inject IAuthorizationService Auth
@inject ManagerLocalizer Localizer
@{
    ViewBag.Title = Localizer.Config["Config"];
    ViewBag.MenuItem = "Config";
}
@section script
{
    <script src="~/manager/assets/js/piranha.config.min.js?v=@Piranha.Utils.GetAssemblyVersionHash(typeof(Piranha.Manager.Module).Assembly)"></script>
}

<div id="config">
    <div class="top">
        <nav aria-label="breadcrumb">
            <ol class="breadcrumb">
                <li class="breadcrumb-item">@Localizer.Menu["System"]</li>
                <li class="breadcrumb-item active" aria-current="page">@Localizer.Menu["Config"]</li>
            </ol>
        </nav>

        <div class="container-fluid">
            <div class="top-nav">
                @foreach (var action in Piranha.Manager.Actions.Toolbars.ConfigEdit)
                {
                    <partial name="@action.ActionView" />
                }
            </div>
        </div>
    </div>

    <div class="container-fluid mb-3 app" :class="{ ready: !loading }">
        <div class="card">
            <div class="card-header">
                <span class="title">@Localizer.General["General"]</span>
            </div>
            <div class="card-body">
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Expanded levels in the sitemap"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The default number of levels that should be expanded in the page sitemap. This is useful for smaller sitemaps."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.expandedSitemapLevels" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Manager list size"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The page size for lists within the manager interface."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.managerPageSize" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Hierarchical page slugs"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["If page slugs should take their parent slug into account when being generated. This is prefered for larger sitemaps."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.hierarchicalPageSlugs = !model.hierarchicalPageSlugs" class="switch switch-lg" :aria-pressed="model.hierarchicalPageSlugs"><span></span></button>
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Collapse blocks"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["If blocks should be collapsed by default when opening a page or post in the manager."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.defaultCollapsedBlocks = !model.defaultCollapsedBlocks" class="switch switch-lg" :aria-pressed="model.defaultCollapsedBlocks"><span></span></button>
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Collapse block headers"]</strong>
                                <span class="text-secondary">@Localizer.Config["If block group headers should be collapsed by default when opening a page or post in the manager."]</span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.defaultCollapsedBlockGroupHeaders = !model.defaultCollapsedBlockGroupHeaders" class="switch switch-lg" :aria-pressed="model.defaultCollapsedBlockGroupHeaders"><span></span></button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="card">
            <div class="card-header">
                <span class="title">@Localizer.General["Archives and Comments"]</span>
            </div>
            <div class="card-body">
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Archive page size"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The default page size for archive pages. Please note that this this can be overridden for specific archives."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.archivePageSize" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Close comments after"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The number of days commenting should be open after publish date. A value of 0 means forever."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.commentsCloseAfterDays" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Comments page size"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The default page size when loading comments. Please note that this this can be overridden for specific pages."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.commentsPageSize" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Enable post comments"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["If comments should be enabled for posts by default. Please note that this this can be overridden for specific posts."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.commentsEnabledForPosts = !model.commentsEnabledForPosts" class="switch switch-lg" :aria-pressed="model.commentsEnabledForPosts"><span></span></button>
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Enable page comments"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["If comments should be enabled for pages by default. Please note that this this can be overridden for specific pages."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.commentsEnabledForPages = !model.commentsEnabledForPages" class="switch switch-lg" :aria-pressed="model.commentsEnabledForPages"><span></span></button>
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Approve comments"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["If comments should be approved by default. Please note that this can be overridden by third party moderation services."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <button v-on:click.prevent="model.commentsApprove = !model.commentsApprove" class="switch switch-lg" :aria-pressed="model.commentsApprove"><span></span></button>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="card">
            <div class="card-header">
                <span class="title">@Localizer.General["History"]</span>
            </div>
            <div class="card-body">
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Page revisions"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The maximum number of page revisions that should be stored for each page. A value of 0 means no limitation."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.pageRevisions" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Post revisions"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The maximum number of post revisions that should be stored for each post. A value of 0 means no limitation."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.postRevisions" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="card">
            <div class="card-header">
                <span class="title">@Localizer.Config["Caching"]</span>
            </div>
            <div class="card-body">
                <ul class="list-group list-group-flush">
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Page cache expiration (minutes)"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The time in minutes that web browsers can use pages before asking the server for new updates."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.pagesExpires" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Post cache expiration (minutes)"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The time in minutes that web browsers can use posts before asking the server for new updates."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.postsExpires" class="form-control" type="number">
                            </div>
                        </div>
                    </li>
                    <li class="list-group-item">
                        <div class="row align-items-end">
                            <div class="col-md-8">
                                <strong class="d-block">@Localizer.Config["Media CDN"]</strong>
                                <span class="text-secondary">
                                    @Localizer.Config["The full URL (including any folder name) to the CDN used to serve uploaded media. Leave blank to use default storage URL."]
                                </span>
                            </div>
                            <div class="col-md-4">
                                <input v-model="model.mediaCDN" class="form-control" type="text">
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
